<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
<script>
    // 创建了一个空的对象
    // let a = {}
    // 创建对象的方法1：
    // 使用 字面量 创建对象 [常用]
    // 使用 { } 创建对象
    // let student = {
    //     name: '李鹏瑜',
    //     height:'158',
    //     weight:'50kg',
    //     sayhello:function(){
    //         console.log("hello")
    //     }
    // }
    // console.log(student.name)
    // console.log(student['height'])
    // console.log(student['weight'])
    // console.log(student.sayhello())

    // 创建对象方法2：使用 new Object 创建对象 
    // let student = new Object()
    // let student = {}
    // student.name = 'lpy'
    // student['height'] = 160
    // student['weight'] = 50
    // student.sayhello = function(){
    //     console.log('hello')
    // }
    // console.log(student.name)
    // console.log(student.height)
    // console.log(student.weight)
    // student.sayhello()

    // 创建对象方法2：使用构造函数创建对象 

    // function People(name,age,weight,height){
    //     this.name = name
    //     this.age = age
    //     this.weight = weight
    //     this.height = height
    //     this.Say = function(){
    //         console.log(name + ' say hello')
    //     }
    // }
    // let xiaoming = new People('xiaoming',20,60,168)
    // let zhangsan = new People('zhangsan',19,50,158)
    // console.log(xiaoming)
    // xiaoming.Say()
    // console.log(zhangsan)
    // zhangsan.Say()

    class People {
        constructor(name,height,weight){
            this.name = name
            this.height = height
            this.weight = weight
        }
        Say(){
            console.log(this.name + "正在说：hello")
        }
        static other = "other"
        static Sum(){
            return 100
        }
    }
    let xiaoming = new People('小明',168,60)
    let zhangsan = new People('张三',158,50)
    console.log(xiaoming)
    xiaoming.Say()
    console.log(zhangsan)
    zhangsan.Say()
    alert(People.other)
    alert(People.Sum())
    class Student extends People{
        constructor(name,height,weight,number){
            super(name,height,weight)
            this.number = number
        }
        Say(){
            alert(this.name)
        }
    }
    let lisi = new Student('李四',168,60,1)
    console.log(lisi)
    lisi.Say()
</script>
</html>